from Tkinter import *
import pygame

def creat_gui(app, mixer, sound_file):
    def change_volume(v):
        """docstring for change_volume"""
        track.set_volume(volume.get())

    def track_toggle():
        """docstring for track_toggle"""
        if track_playing.get():
            track.play(loops = -1)
        else:
            track.stop()

    track = mixer.Sound(sound_file)
    track.set_volume(0.5)

    track_playing = IntVar()
    toggle_button = Checkbutton(app, variable = track_playing, command = track_toggle, text = sound_file)
    toggle_button.pack(side = LEFT)

    #SET volume
    volume = DoubleVar()
    volume_scale = Scale(variable = volume,
                        from_ = 0.0,
                        to  = 1.0,
                        resolution = 0.01,
                        command = change_volume,
                        label = "Volume",
                        orient = HORIZONTAL)
    # set the default volume
    volume_scale.set(0.5)
    volume_scale.pack(side=RIGHT)
